package com.pharmacy.pharmacy.controller;

import com.pharmacy.pharmacy.domain.Employee;
import com.pharmacy.pharmacy.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@CrossOrigin
/**
 * 【】Controller
 * 
 * @author 
 * @date 2025-05-08
 */
@RestController
@RequestMapping("/system/employee")
public class EmployeeController 
{
    @Autowired
    private IEmployeeService employeeService;

    /**
     * 查询【】列表
     */
    @GetMapping("/list")
    public List<Employee> list(Employee employee)
    {
        return employeeService.selectEmployeeList(employee);
    }

    /**
     * 获取【】详细信息
     */
    @GetMapping(value = "/{id}")
    public Employee getInfo(@PathVariable("id") Long id)
    {
        return employeeService.selectEmployeeById(id);
    }

    /**
     * 新增【】
     */
    @PostMapping
    public int add(@RequestBody Employee employee)
    {
        return employeeService.insertEmployee(employee);
    }

    /**
     * 修改【】
     */
    @PutMapping
    public int edit(@RequestBody Employee employee)
    {
        return employeeService.updateEmployee(employee);
    }

    /**
     * 删除【】
     */
    @DeleteMapping("/{ids}")
    public int remove(@PathVariable Long[] ids)
    {
        return employeeService.deleteEmployeeByIds(ids);
    }
}
